"use strict";
var loading = !1
  , app = new Vue({
    el: "#app",
    data: {
        itabs: [{
            name: "本地人物",
            type: 5
        }, {
            name: "企业访谈",
            type: 6
        }, {
            name: "评析",
            type: 7
        }],
        tabs: [{
            name: "全部时间",
            id: 0
        }, {
            name: "最近一月",
            id: 1
        }],
        tabContents: ["内容一", "内容二", "内容三", "没有内容了"],
        listTab: [],
        Type: 0,
        hideing: !0,
        types: 5,
        pageIndex: 1,
        pageSize: 10,
        userId: 0,
        cityId: 0
    },
    created: function() {
        if ("" != $.getPara("userId")) {
            var t = $.getPara("userId");
            this.userId = t,
            $.setStorage("userId", t)
        } else if ($.getStorage("userId") && "" != $.getStorage("userId")) {
            t = parseInt($.getStorage("userId"));
            this.userId = t
        }
        if ($.getPara('cityId')) {  //获取分享的参数
            this.cityId = $.getPara('cityId');
        }
        var e = $.GetRequest().types;
        e && (this.types = e);
        var i = $.getPara("cityId");
        i ? this.cityId = i : $.toast("未获取分站城市的ID", "text"),
        this.getList()
    },
    mounted: function() {
        var e = this;
        this.$nextTick(function() {
            $(document.body).infinite().on("infinite", function() {
                loading || (loading = !0,
                e.hideing = !1,
                setTimeout(function() {
                    var t = e.pageIndex;
                    t++,
                    e.pageIndex = t,
                    e.getList(),
                    loading = !1
                }, 1500))
            })
        })
    },
    methods: {
        backTop: function() {
            window.history.go(-1)
        },
        getList: function() {
            var n = this;
            $.ajax({
                url: "/api/dynamic/list",
                type: "get",
                dataType: "json",
                data: {
                    type: n.types,
                    timeType: n.Type,
                    cityId: n.cityId,
                    pageIndex: n.pageIndex,
                    pageSize: n.pageSize
                }
            }).done(function(t, e, i) {
                if (200 == t.code) {
                    var s = t.data.list;
                    if (0 < s.length) {
                        var a = n.listTab.concat(s);
                        n.listTab = a
                    } else
                        loading = !0;
                    n.hideing = !0
                }
            })
        },
        tab: function(t) {
            t != this.types && (this.types = t,
            this.Type = 0,
            this.pageIndex = 1,
            this.listTab = [],
            this.getList())
        },
        tab2: function(t) {
            t != this.Type && (this.Type = t,
            this.pageIndex = 1,
            this.listTab = [],
            this.getList())
        },
        urlHref: function(t) {
            var e = this
              , i = {};
            5 == e.types && (i.title = "人物详情"),
            6 == e.types && (i.title = "访谈详情"),
            7 == e.types && (i.title = "评析详情"),
            i.type = "local",
            i.url = "/PageClassify/html/Substation/Character/subCharacterDetails.html?id=" + t.id + "&types=" + e.types+"&cityId="+e.cityId,
            0 < this.userId && (i.url = "/PageClassify/html/Substation/Character/subCharacterDetails.html?id=" + t.id + "&userId=" + this.userId + "&types=" + e.types+"&cityId="+e.cityId),
            /(Android)/i.test(navigator.userAgent) ? jsAndroid.appPush(JSON.stringify(i)) : /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent) ? (window.webkit.messageHandlers.appPush.postMessage(i),
            f) : window.location.href = i.url
        }
    }
});
